//
//  GroupPurchaseHomeCtr.swift
//  eemall
//
//  Created by zhuxietong on 2018/12/24.
//  Copyright © 2018 tianrun. All rights reserved.
//

import UIKit
import Foundation
import soapp
import AsyncDisplayKit
import Eelay




public class GroupPurchaseHomeCtr:ASCollectionContainer{
    
    override open var sections: TP.section{
        get{
            let sec:TP.section = [
                [
                    ["cellID":"adv","options":DataNode.path(node: "banner", mo.detail, value: NSMutableArray())]
                ],
                [
                ]
            ]
            return sec
        }
    }
    
    override open var selector:TP.selector{
        return [
            "cellID<adv>":LoopNode<GoodsActive.TopKit>.self,
            "<default>":Goods.GroupListCell.self
        ]
    }
    override public func viewDidLoad() {
        self.page_load_section = "section1"
        self.content = ASTermsContainer.list(
            net: JoTask().post.log.log_response()._surl(.团购首页),
            node: "goods.list",
            emptyMsg: "",
            params: nil,
            cellType: Goods.GroupListCell.self,
            detailType: GroupGoodsDetailCtr.self,
            test: false
        )
        title = "团购".loc
        flowLayout.sectionHeadersPinToVisibleBounds = true
        //        flowLayout.headerReferenceSize = [Swidth,30]
        collectionNode.registerSupplementaryNode(ofKind: UICollectionView.elementKindSectionHeader)
        super.viewDidLoad()
        collectionNode.backgroundColor = ._background
//        paginator.type = .bottom
        //        tableNode.backgroundColor = UIColor.white
        reload_page()
        
    }
    
    override open func load(page: Int, succeed: Bool, list: [Any], response: RootData?, status: PageDataStatus, scrollView: UIScrollView) {
        if succeed
        {
            if page == self.paginator.page_begin
            {
                if let dict = response as? NSMutableDictionary{
                    self.mo.detail = dict
                    //                    self.loadingV.dismiss()
                }
            }
        }
        super.load(page: page, succeed: succeed, list: list, response: response, status: status, scrollView: scrollView)
    }
    
    
    
    override open func touch(cell: Any, actionID: String, model: NSMutableDictionary) {
    }
    
    
    
    
    
    deinit {
    }
    
}
